package com.tmall.tmall.mapper;

import com.tmall.tmall.pojo.Orders;
import com.tmall.tmall.pojo.OrdersGt;
import com.tmall.tmall.pojo.OrdersRt;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into orders (uid, order_code, sum, total_number, address, post, name, tel, user_message, create_date, status) value " +
            "(#{uid},#{orderCode},#{sum},#{totalNumber},#{address},#{post},#{name},#{tel},#{userMessage},#{createDate},#{status})")
    void insert(Orders orders);

    @Select("select * from orders where delete_at is null and id=#{id}")
    Orders getById(Integer id);

    void update(Orders orders);

    List<OrdersRt> page( String name, String tel, String address, Integer status,Integer uid,String username);
}
